package com.greensam.pixelengine.pojo.vo.role.response;

import cn.hutool.core.bean.BeanUtil;
import com.greensam.pixelengine.pojo.base.BaseDto;
import com.greensam.pixelengine.pojo.entity.RolePo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.io.Serial;
import java.util.Objects;

/**
 * @author Macro_Ray
 * @since 2025/6/30 15:03
 */
@Getter
@Setter
@Schema(title = "角色信息")
public class RoleVo extends BaseDto {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(title = "角色ID")
    private Long id;

    @Schema(title = "角色名称")
    private String name;

    @Schema(title = "角色标识")
    private String value;

    /**
     * 空间实体类转封装类
     *
     * @param po 空间实体类
     * @author Ma Chengrui
     * @since 2025/6/30
     */
    public static RoleVo rolePo2Vo(RolePo po) {
        if (Objects.isNull(po)) {
            return null;
        }
        return BeanUtil.copyProperties(po, RoleVo.class);
    }
}
